#include <string>
#include "atomic.h"
#include "message.h"
#include "mainsimu.h"
#include "strutil.h"
#include "../HeadFile/ERP_input_2_model.h"


/**** the Constructor ****/
ERP_input_2_model::ERP_input_2_model( const string &name)
: Atomic( name )
, ERP_input_2_stream_in( this->addInputPort( "ERP_input_2_stream_in") )
, ERP_input_2_stream_crude( this->addOutputPort( "ERP_input_2_stream_crude") )
{

}


/*** the initFunction ***/
Model &ERP_input_2_model::initFunction()
{

		
	count = 0;
	delay = "00:00:00:00";
	passivate();
	return *this;
		
		
}

/*** the externalFunction ***/
Model &ERP_input_2_model::externalFunction( const ExternalMessage &msg )
{

			
	if( msg.port() == ERP_input_2_stream_in){
		ERP_input_2_stream_in_flowrate = msg.value();
		holdIn( active, delay);
	}
	return *this;

		
		
}

/*** the internalFunction ***/
Model &ERP_input_2_model::internalFunction( const InternalMessage &msg )
{

			
	passivate();
	return *this;
		
		
}

/*** the outputFunction ***/
Model &ERP_input_2_model::outputFunction( const InternalMessage &msg )
{

			
	ERP_input_2_stream_crude_flowrate = ERP_input_2_stream_in_flowrate;
	sendOutput( msg.time(), ERP_input_2_stream_crude, ERP_input_2_stream_crude_flowrate);
	return *this;
		
		
}

